/*
 * Copyright (C) 2012 David Bordoley
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package restlib;

import java.util.List;
import java.util.Set;

import com.google.common.base.Optional;

import restlib.data.ContentEncoding;
import restlib.data.ContentRange;
import restlib.data.Language;
import restlib.data.MediaRange;
import restlib.net.Uri;

final class ContentInfoImpl extends ContentInfo {
    private final Optional<Uri> contentLocation;
    private final Optional<ContentRange> contentRange;
    private final List<ContentEncoding> encoding;
    private final Set<Language> language;
    private final Optional<MediaRange> mediaRange;
    private final Optional<Long> contentLength;
    
    ContentInfoImpl(final ContentInfoBuilder builder){
        this.contentLocation = builder.contentLocation;
        this.contentRange = builder.contentRange;
        this.encoding = builder.encoding.build();
        this.language = builder.language.build();
        this.mediaRange = builder.mediaRange;
        this.contentLength = builder.contentLength;
    }

    public Optional<Uri> location() {
        return this.contentLocation;
    }
  
    public List<ContentEncoding> encodings() {
        return this.encoding;
    }

    public Set<Language> languages() {
        return this.language;
    }

    public Optional<MediaRange> mediaRange() {
        return this.mediaRange;
    }

    public Optional<Long> length() {
        return this.contentLength;
    }

    public Optional<ContentRange> range() {
        return this.contentRange;
    }
}
